<template>
  <div class="tags">
    <div class="tags-wrap">
      <label class="tags-label">{{label}}</label>
    </div>
    <div class="tags-span">
      <span v-for="(item,index) in tagsData" :key="index" @click="checkTags(item)" :class="{checked: checkedTags===item}">{{item}}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'MyTags',
  props: {
    label: String,
    tagsData: Array,
    checkedTags: String
  },
  methods: {
    checkTags(item) {
      this.$emit('checkTags', item)
    }
  }
}
</script>

<style lang="less" scoped>
.tags {
  display: flex;
  align-items: center;
  background-color: #fff;
  .tags-wrap {
    padding: 15px 20px;
    .tags-label {
      color: #333;
      font-weight: 700;
      font-size: 18px;
    }
  }
  .tags-span {
    margin-left: 15px;
    span {
      padding: 5px 20px;
      background-color: #fff;
      border: 1px solid #eee;
      margin: 0 10px;
      &.checked {
        color: #2395ff !important;
        background: #eef7ff !important;
        border-color: rgba(35, 149, 255, 0.18) !important;
      }
    }
  }
}
</style>
